package Thread;
class Test {
    public  int value =0;
}
public class Demo9 {
    public  static    boolean  isFinished = false;
    public static void main(String[] args) {
        //boolean isFinished = false;
        Test test = new Test();
        Thread t = new Thread(()->{
           while (!isFinished){
               System.out.println("这是在终止线程 hallo Thread");
               try {
                   Thread.sleep(3000);
               } catch (InterruptedException e) {
                   throw new RuntimeException(e);
               }
           }
            System.out.println("thread 结束");
            System.out.println("test 结束");
            test.value++;
        });
        t.start();
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        isFinished =true;
    }
}
